import { lazy } from 'react'
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
import { RouterType } from '@/types'

export const BasicRoute: RouterType[] = [
  {
    path: '/login',
    Component: lazy(() => import('@/views/login')),
  },
  {
    path: '/',
    Component: lazy(() => import('@/Layout')),
    children: [
      {
        name: '用户管理',
        centerName: '用户中心',
        path: '/usercenter',
        icon: '',
        children: [
          {
            name: '人员管理',
            path: '/usercenter/personnel/center',
            children: [
              {
                name: '租户管理员',
                path: '/usercenter/personnel/center/tenement',
                actionUrl: [],
                Component: lazy(() => import('@/views/personnel/tenement')),
              },
              {
                name: '学员用户',
                path: '/usercenter/personnel/center/all',
                actionUrl: [],
                Component: lazy(() => import('@/views/personnel/cadet')),
              },
            ],
          },
          {
            name: '部门管理',
            path: '/usercenter/department',
            actionUrl: ['/user/origin/list'],
            Component: lazy(() => import('@/views/department')),
          },
          {
            name: '群组管理',
            path: '/usercenter/group',
            actionUrl: ['/user/group/list'],
            Component: lazy(() => import('@/views/group')),
          },
          {
            name: '权限管理',
            actionUrl: ['/user/admin/admin/list'],
            path: '/usercenter/authority',
            Component: lazy(() => import('@/views/authority')),
          },
        ],
      },
      {
        name: '资源管理',
        centerName: '资源中心',
        path: '/resourcecenter',
        icon: '',
        children: [
          {
            name: '属性管理',
            path: '/resourcecenter/attribute',
            children: [
              {
                name: '知识点',
                path: '/resourcecenter/attribute/knowledgePoint',
                actionUrl: ['/resource/admin/attribute/list'],
              },
              {
                name: '技能',
                path: '/resourcecenter/attribute/skill',
                actionUrl: ['/resource/admin/attribute/list'],
              },
              {
                name: '能力',
                path: '/resourcecenter/attribute/ability',
                actionUrl: ['/resource/admin/attribute/list'],
              },
            ],
          },
          {
            name: '标签管理',
            path: '/resourcecenter/tag',
            actionUrl: ['/resource/admin/tag/list'],
          },
          {
            name: '题库管理',
            path: '/resourcecenter/question',
            actionUrl: ['/resource/admin/question/list'],
          },
          {
            name: '试卷管理',
            path: '/resourcecenter/paper',
            actionUrl: ['/resource/admin/paper/list'],
          },
          {
            name: '课件管理',
            path: '/resourcecenter/courseware',
            children: [
              {
                name: '视频',
                path: '/resourcecenter/courseware/video',
                actionUrl: ['/resource/admin/video/list'],
              },
              {
                name: '讲义',
                path: '/resourcecenter/courseware/handouts',
                actionUrl: ['/resource/admin/handouts/list'],
              },
              {
                name: '实验',
                path: '/resourcecenter/courseware/experiment',
                actionUrl: ['/resource/admin/experiments/list'],
              },
            ],
          },
          {
            name: '课程管理',
            path: '/resourcecenter/course',
            actionUrl: ['/resource/admin/course/list'],
          },
          {
            name: '资源看板',
            path: '/resourcecenter/statistics',
            actionUrl: ['/resource/admin/reso-board/info'],
          },
        ],
      },
      {
        name: '运营管理',
        centerName: '运营中心',
        path: '/operationcenter',
        icon: '',
        children: [
          {
            name: '租户管理',
            path: '/operationcenter/tenant',
            actionUrl: ['/operation-center/admin/tenant/list'],
          },
          {
            name: '业务模板',
            path: '/operationcenter/template',
            actionUrl: ['/operation-center/admin/tmp/list'],
          },
          {
            name: '消息通知',
            path: '/operationcenter/message',
            actionUrl: ['/operation-center/admin/notice/list'],
          },
        ],
      },
      {
        name: '订单中心',
        path: '/ordercenter',
        icon: '',
        children: [
          {
            name: '订单管理',
            path: '/ordercenter/management',
            actionUrl: ['/operation-center/admin/order/list'],
          },
        ],
      },
      {
        name: '应用中心',
        path: '/appCenter',
        icon: '',
        children: [
          {
            name: '应用配置',
            path: '/appCenter/config',
            actionUrl: ['/app/list'],
          },
        ],
      },
      {
        name: '日志管理',
        centerName: '日志中心',
        path: '/logCenter',
        icon: '',
        children: [
          {
            name: '日志管理',
            path: '/logCenter/management',
            actionUrl: ['/auth/admin/action/log'],
          },
        ],
      },
      {
        name: '认证',
        path: '/authentication',
        icon: '',
        children: [
          {
            name: '认证等级',
            path: '/authentication/ranklist',
            actionUrl: ['/cert/admin/cert-cate/list'],
          },
          {
            name: '认证考点',
            path: '/authentication/examsite',
            actionUrl: ['/cert/admin/cert-location/list'],
          },
          {
            name: '考试列表',
            path: '/authentication/examination',
            actionUrl: ['/cert/admin/exam/list'],
          },
          {
            name: '专业认证',
            path: '/authentication/professional',
            actionUrl: ['/cert/admin/session-major/list'],
          },
          {
            name: '教师认证',
            path: '/authentication/teacher',
            actionUrl: ['/cert/admin/session-teacher/list'],
          },
          {
            name: '学生认证',
            path: '/authentication/1+x',
            actionUrl: ['/cert/admin/session-student/list'],
          },
        ],
      },

      {
        name: '测评',
        path: '/appraisal',
        icon: '',
        children: [
          {
            name: '岗位列表',
            path: '/appraisal/jobs',
            actionUrl: ['/evaluation/admin/position/list'],
          },
          {
            name: '测评场次',
            path: '/appraisal/certification-session-asmt',
            actionUrl: ['/evaluation/admin/session/list'],
          },
          {
            name: '考试列表',
            path: '/appraisal/exam-list-asmt',
            actionUrl: ['/evaluation/admin/exam/list'],
          },
        ],
      },
      {
        name: '教学',
        path: '/training',
        icon: '',
        children: [
          {
            name: '教务列表',
            path: '/training/academicAffairs',
            actionUrl: ['/campus/admin/dean/list'],
          },
          {
            name: '教师列表',
            path: '/training/schoolteacher',
            actionUrl: ['/campus/admin/teacher/list'],
          },
          {
            name: '班级列表',
            path: '/training/class',
            actionUrl: ['/campus/admin/class/list'],
          },
          {
            name: '教学配置',
            path: '/training/resource',
            children: [
              {
                name: '专业配置',
                path: '/training/resource/majorConfig',
                actionUrl: ['/campus/admin/major/list'],
              },
              {
                name: '直播配置',
                path: '/training/resource/livestreaming',
                actionUrl: ['/campus/admin/live-course/list'],
              },
            ],
          },
          {
            name: '学员管理',
            path: '/training/student',

            actionUrl: ['/campus/admin/student/list'],
          },
          {
            name: '考试管理',
            path: '/training/test',
            children: [
              {
                name: '考试列表',
                path: '/training/test/stage-exam',
                actionUrl: ['/campus/admin/exam/list'],
              },
              {
                name: '考试记录',
                path: '/training/test/stage-record',
                actionUrl: ['/campus/admin/exam/record'],
              },
            ],
          },
        ],
      },
      {
        name: '配置中心',
        path: '/configCenter',
        icon: '',
        children: [
          {
            name: '配置项管理',
            path: '/configCenter/management',
            actionUrl: ['/config/admin/config/list'],
          },
          {
            name: '菜单管理',
            path: '/configCenter/menuConfig',
            children: [
              {
                name: '平台菜单',
                path: '/configCenter/menuConfig/platformmenu',
                actionUrl: ['/auth/admin/menu/list'],
              },
              {
                name: '租户菜单',
                path: '/configCenter/menuConfig/tenantmenu',
                actionUrl: ['/auth/admin/menu/list'],
              },
            ],
          },
        ],
      },
    ],
  },
  {
    path: '*',
    Component: lazy(() => import('@/components/Exception')),
  },
]

const routes = createBrowserRouter(BasicRoute)

export const Router = () => {
  return <RouterProvider router={routes} />
}

export default Router
